/* Copyright 2022 The TensorFlow Authors. All Rights Reserved.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
==============================================================================*/

syntax = "proto3";

package tensorflow;

import "tensorflow/compiler/xla/service/hlo.proto";

// Represents the cache key used for persistence.
message XlaSerializedCacheKey {
  uint64 signature_fingerprint = 1;
  uint64 cluster_fingerprint = 2;
  string device_type = 3;
  string prefix = 4;
  bool compiled_using_pjrt = 5;
}

// Represents an entry in the XLA compile cache.
message XlaSerializedCacheEntry {
  // Used to uniqely identify this entry in its persisted representation.
  XlaSerializedCacheKey key = 1;

  // The computation (HLO) that compilation was done for. It is correlated to
  // the input TF graph so we can use it to fingerprint the compiled binary. We
  // serialize this rather than the input graphdef because it provides a
  // stronger guarantee over what bindings are needed between the HLO and
  // calling TF graph.
  xla.HloModuleProto hlo_module = 2;

  // The raw bytes of the executable.
  bytes executable = 3;
}
